import {
  Entity,
  PrimaryGeneratedColumn,
  ManyToMany,
  Column,
  JoinTable,
} from 'typeorm';
import { UsersEntity } from '../users/users.entity';

@Entity({ name: 'job' })
export class JobEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column('varchar')
  name: string;

  @Column('varchar')
  describe: string;

  @Column('datetime')
  createDate: string;

  @Column('float')
  order: number;

  //预留菜单字段

  @ManyToMany(
    type => UsersEntity,
    user => user.job,
    { cascade: true },
  )
  users: UsersEntity[];
}
